package com.yckj.dao;

import org.junit.Test;

import java.util.Scanner;

import static org.junit.Assert.*;

public class UserDaoTest {
    UserDao userDao = new UserDao();
    @Test
    public void insertUser() {
        int flag = userDao.insertUser("LvZewei","t1ab90");
        if (flag == 1){
            System.out.println("注册成功！");
        }else {
            System.out.println("注册失败！");
        }
    }

    @Test
    public void login() {
//        Scanner scanner=new Scanner(System.in);
//        System.out.println("请输入用户名：");
//        String uname=scanner.next();
//        System.out.println("请输入密码：");
//        String upsw = scanner.next();
        boolean flag = userDao.login("LvZewei", "t1ab");
        if (flag == true){
            System.out.println("登录成功！");
        }else {
            System.out.println("用户名或密码错误！");
        }
    }

    @Test
    public void deleteUser() {
        int flag = userDao.deleteUser(1);
        if (flag == 1){
            System.out.println("删除成功！");
        }else {
            System.out.println("删除失败！");
        }
    }

    @Test
    public void updateUser() {
        int flag = userDao.updateUser(2, "WangHaitao", "t1ab");
        if (flag == 1){
            System.out.println("修改成功！");
        }else {
            System.out.println("修改失败！");
        }
    }

    @Test
    public void selectAllUser() {
        System.out.println(userDao.selectAllUser());
    }
}